$(function() {
	var app = new Vue({
		el: '#app',
		data: {
			Language: {}, //语言包
			mylist: { //缓存我的优惠券
				result: {
					list: ""
				}
			}
		},
		methods: {
			Langes: function(v) {
				$.ajax({
					type: "get",
					dataType: "json",
					url: "../Langue/" + v + ".json",
					success: function(h) {
						app.Language = h;
					},
					error: function(e) {
						console.log("错误");
					}
				});
			},
			mt: function() { //加载我的优惠券列表
				let data = {};
				data.type = 1; //1:表示正常 2:表示失效
				data.page = 1; //页数
				common_ajax("get_my_coupon_list", data, "zh", function(h) {
					app.mylist = h;
				});
			}
		},
		filters: {
			formatDate: function(time) {
				var date = new Date(time*1000);
				return formatDate(date, 'yyyy-MM-dd');
			}
		}
	})
	//首次加载语言
	if(localStorage.getItem("lanuage")) {
		app.Langes(localStorage.getItem("lanuage"));
	} else {
		app.Langes("en");
	}
	//加载数据我的优惠券
	app.mt();
	$("#lose").click(function() {
		$(window).attr("location", "Lose.html")
	});

})